Nguyen Bich Ngoc, Jacques Teller 24 December 2021
inccatdf <- df[!(is.na(df$inccat)),] %>%
group_by(inccat) %>%
summarise(
count = n(),
prop = n() / nrow(df),
income_avr = mean(income),
income_min = min(income),
income_max = max(income),
inceqa_avr = mean(inceqa),
inceqa_min = min(inceqa),
inceqa_max = max(inceqa)
)
inccatdf## # A tibble: 4 x 9
## inccat count prop income_avr income_min income_max inceqa_avr
## <fct> <int> <dbl> <dbl> <int> <int> <dbl>
## 1 precarious 164 0.0949 1144. 125 2250 8928.
## 2 modest 781 0.452 1894. 1250 3250 16022.
## 3 average 566 0.328 3216. 2250 4750 23687.
## 4 higher 216 0.125 4759. 3750 5250 30933.
## # ... with 2 more variables: inceqa_min <dbl>, inceqa_max <dbl>
| Utilities | Number of households | CVD | CVA | Average price | Block 1 price | Block 2 price | Block2/Block1 |
|---|---|---|---|---|---|---|---|
| SWDE | 1308 | 2.4480 | 1.745 | 4.7061 | 1.2974 | 4.4446 | 3.4257 |
| CILE | 277 | 2.6366 | 1.745 | 4.9270 | 1.3974 | 4.6445 | 3.3237 |
| inBW | 143 | 2.1600 | 1.745 | 4.3268 | 1.1448 | 4.1393 | 3.6157 |
## Warning: Removed 192 row(s) containing missing values (geom_path).
## Warning: Removed 150 row(s) containing missing values (geom_path).
| Quintile | Number of households | Number of people | Min income (EUR/month) | Max income (EUR/month) |
|---|---|---|---|---|
| 1 | 346 | 550 | 125 | 1750 |
| 2 | 346 | 695 | 1750 | 2250 |
| 3 | 346 | 823 | 2250 | 2750 |
| 4 | 345 | 967 | 2750 | 3750 |
| 5 | 345 | 1156 | 3750 | 5250 |
# Correlation between water consumption and household income should use spearman?????
cor.test(df$csmptv, df$income, method = "pearson")##
## Pearson's product-moment correlation
##
## data: df$csmptv and df$income
## t = 15.729, df = 1726, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3121384 0.3946480
## sample estimates:
## cor
## 0.354082
cor.test(df$csmptv, df$income, method = "spearman")## Warning in cor.test.default(df$csmptv, df$income, method = "spearman"):
## Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: df$csmptv and df$income
## S = 536353649, p-value < 2.2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.3763062
# Correlation between water consumption and income per equivalent adult should use spearman?????
cor.test(df$csmptv, df$inceqa, method = "pearson")##
## Pearson's product-moment correlation
##
## data: df$csmptv and df$inceqa
## t = 1.4269, df = 1726, p-value = 0.1538
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.01285165 0.08134826
## sample estimates:
## cor
## 0.03432454
cor.test(df$csmptv, df$inceqa, method = "spearman")## Warning in cor.test.default(df$csmptv, df$inceqa, method = "spearman"):
## Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: df$csmptv and df$inceqa
## S = 803896839, p-value = 0.006707
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.06519613
summary(df$avrprc)## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 4.200 4.595 4.690 5.000 4.850 12.549
summary(df$avrprc[df$poorest == 1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
##
summary(df$avrprc[df$inccat == "precarious"])## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 4.222 4.605 4.734 5.152 4.915 10.592 1
summary(df$subs[df$inccat == "precarious"])## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -68.1035 -4.7756 0.5658 -4.0094 8.3744 27.4910 1
summary(df$mgnprc)## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.158 4.458 4.458 3.982 4.458 4.658
summary(df$mgnprc[df$poorest == 1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
##
summary(df$mgnprc[df$inccat == "precarious"])## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1.158 4.153 4.458 3.754 4.458 4.658 1
## 3.5. changing fixed -----
### new cvd ------| CVD_SWDE | CVD_CILE | CVD_inBW | CVA | scenario | fixed | rwtt | mgpr_bl1 | mgpr_bl2 |
|---|---|---|---|---|---|---|---|---|
| 2.4480 | 2.6366 | 2.1600 | 1.745 | As in 2014 | 101.438 | 0 | 1.2272 | 4.1994 |
| 4.2744 | 4.5442 | 3.6839 | 1.745 | 1 | 0.000 | 0 | 2.1344 | 6.0138 |
| 3.3730 | 3.6365 | 2.8864 | 1.745 | 2 | 50.000 | 0 | 1.6875 | 5.1200 |
| 2.4716 | 2.7289 | 2.0890 | 1.745 | 3 | 100.000 | 0 | 1.2406 | 4.2262 |
| 1.5702 | 1.8212 | 1.2916 | 1.745 | 4 | 150.000 | 0 | 0.7937 | 3.3324 |
| 0.6688 | 0.9135 | 0.4942 | 1.745 | 5 | 200.000 | 0 | 0.3468 | 2.4386 |
| CVD_SWDE | CVD_CILE | CVD_inBW | CVA | scenario | fixed | rwtt | mgpr_bl1 | mgpr_bl2 |
|---|---|---|---|---|---|---|---|---|
| 2.4480 | 2.6366 | 2.1600 | 1.745 | 6 | 101.4380 | 0 | 1.2272 | 4.1994 |
| 2.1517 | 2.4683 | 1.8852 | 1.745 | 7 | 95.9578 | 50 | 1.0902 | 3.9254 |
| 1.8554 | 2.3000 | 1.6104 | 1.745 | 8 | 90.4777 | 100 | 0.9532 | 3.6514 |
| 1.5591 | 2.1318 | 1.3356 | 1.745 | 9 | 84.9975 | 150 | 0.8162 | 3.3774 |
| 1.2628 | 1.9635 | 1.0608 | 1.745 | 10 | 79.5174 | 200 | 0.6792 | 3.1034 |
| bl1_SWDE | bl1_CILE | bl1_inBW | fixed | revincr | mgpr_bl1 | mgpr_bl2 |
|---|---|---|---|---|---|---|
| 4.427231 | 4.635599 | 4.069370 | 0 | 0.0 | 4.431018 | 4.431018 |
| 3.710676 | 3.914732 | 3.423071 | 50 | 0.0 | 3.719586 | 3.719586 |
| 2.994121 | 3.193866 | 2.776773 | 100 | 0.0 | 3.008154 | 3.008154 |
| 5.315177 | 5.565218 | 4.885744 | 0 | 0.2 | 5.319721 | 5.319721 |
| 4.598622 | 4.844352 | 4.239446 | 50 | 0.2 | 4.608289 | 4.608289 |
| 3.882067 | 4.123486 | 3.593147 | 100 | 0.2 | 3.896857 | 3.896857 |
| 6.647096 | 6.959648 | 6.110305 | 0 | 0.5 | 6.652777 | 6.652777 |
| 5.930541 | 6.238782 | 5.464006 | 50 | 0.5 | 5.941345 | 5.941345 |
| 5.213986 | 5.517916 | 4.817708 | 100 | 0.5 | 5.229913 | 5.229913 |
| bl1_SWDE | bl1_CILE | bl1_inBW | fixed | revincr | mgpr_bl1 | mgpr_bl2 |
|---|---|---|---|---|---|---|
| 1.789001 | 1.876093 | 1.594286 | 0 | 0.0 | 1.786848 | 6.253969 |
| 1.499448 | 1.584348 | 1.341081 | 50 | 0.0 | 1.499952 | 5.249832 |
| 1.209895 | 1.292603 | 1.087876 | 100 | 0.0 | 1.213056 | 4.245695 |
| 2.147811 | 2.252323 | 1.914122 | 0 | 0.2 | 2.145226 | 7.508291 |
| 1.858259 | 1.960578 | 1.660917 | 50 | 0.2 | 1.858330 | 6.504154 |
| 1.568706 | 1.668834 | 1.407712 | 100 | 0.2 | 1.571433 | 5.500017 |
| 2.686027 | 2.816669 | 2.393877 | 0 | 0.5 | 2.682792 | 9.389773 |
| 2.396474 | 2.524924 | 2.140672 | 50 | 0.5 | 2.395896 | 8.385636 |
| 2.106921 | 2.233179 | 1.887467 | 100 | 0.5 | 2.109000 | 7.381499 |
| bl1_SWDE | bl1_CILE | bl1_inBW | fixed | revincr | mgpr_bl1 | mgpr_bl2 |
|---|---|---|---|---|---|---|
| 1.816621 | 1.870233 | 1.608886 | 0 | 0.0 | 1.808024 | 6.328085 |
| 1.522598 | 1.579399 | 1.353362 | 50 | 0.0 | 1.517698 | 5.311944 |
| 1.228575 | 1.288566 | 1.097838 | 100 | 0.0 | 1.227372 | 4.295803 |
| 2.180972 | 2.245288 | 1.931651 | 0 | 0.2 | 2.170649 | 7.597272 |
| 1.886948 | 1.954454 | 1.676128 | 50 | 0.2 | 1.880323 | 6.581131 |
| 1.592925 | 1.663621 | 1.420604 | 100 | 0.2 | 1.589997 | 5.564990 |
| 2.727497 | 2.807871 | 2.415800 | 0 | 0.5 | 2.714586 | 9.501052 |
| 2.433473 | 2.517037 | 2.160276 | 50 | 0.5 | 2.424260 | 8.484911 |
| 2.139450 | 2.226204 | 1.904752 | 100 | 0.5 | 2.133934 | 7.468770 |